﻿using System;

namespace TinyContainer
{
    /// <summary>
    /// The main interface for the ioc container
    /// </summary>
    public interface IContainer
    {
        /// <summary>
        /// This method will try to resolve an object based on the given interface
        /// </summary>
        /// <typeparam name="T">The type to resolve</typeparam>
        /// <returns></returns>
        T Resolve<T>(string name="");

        /// <summary>
        /// This method will try to resolve an object based on the given interface
        /// </summary>
        /// <param name="type">The type to resolve</param>
        /// <returns></returns>
        object Resolve(Type type,string name="");
        /// <summary>
        /// This is where you can map an interface to a class
        /// </summary>
        /// <param name="interface"></param>
        /// <param name="class"></param>
        void Register<T,C>(string name="") where C:T;

        /// <summary>
        /// Used for registring and instance
        /// </summary>
        /// <param name="interface"></param>
        /// <param name="instance"></param>
        void Register<T>(T instance,string name="");

        /// <summary>
        /// Checks whether the type is registered in the interface or not 
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        bool IsRegistered<T>(string name="");

        /// <summary>
        /// This function will remove an already existing 
        /// instance from the container
        /// </summary>
        /// <param name="instance"></param>
        void Remove(object instance);
    }
}
